import { hexToRgba } from '../../../untils/commonUtils';

export default function (props) {
  //console.log("进入js:",props)
  const background = props.background;

  if (!background) return '';

  const borderStyle = {
    borderWidth: `${background.borderWidth || 0}px`,
    borderStyle: background.borderStyle || 'solid',
    borderColor: hexToRgba(
      background.borderColor || '#121212',
      background.borderOpacity || 0.6
    ),
  };

  const boxShadow = `${background.shadowX}px ${background.shadowY}px ${background.shadowBlur}px ${background.shadowDiff}px ${background.shadowColor}`;

  // const borderRadius = props.info.code === 'circle' ? '50%' : `${background?.borderRadius ?? 0}px`;
  let borderRadius = `${background.borderRadius || 0}px`;
  if (props.code === 'circle') borderRadius = '50%';
  if (props.code === 'triangle') borderRadius = '0';

  return {
    backgroundColor: hexToRgba(
      background.color || '#121212',
      background.opacity || 0.6
    ),
    borderRadius: borderRadius,
    ...borderStyle,
    boxShadow,
  };
}
